<!DOCTYPE html>
<html>

<head lang="en">
    <title>找攻略</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/repliesComment.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <!-- 引入jquery 和 common.js 可以获取到地址栏上拼接的参数 -->
    <script type="text/javascript" src="/js/common.js"></script>
    <!-- 如果到底了就提示用户到底了的消息插件-->
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script>
        $(function () {
            var user = JSON.parse(sessionStorage.getItem("user"));
            var params = getParams();
            var currentPage = 1;
            var pages;
            var travelArr = []; // js中数组是边长的,很方便做数组拼接
            function query() {
                $.get("/strategieLikes/" + user.id + "/comments",{currentPage: currentPage,type:params.id}, function (data) {
                    $.merge(travelArr, data.list);
                    var json = {
                        list: travelArr
                    }
                    $(".replyComment").renderValues(json,{
                        getHref:getHref
                    });
                    pages = data.pages;
                })
                currentPage = currentPage + 1;
            }

            query();
            //给window绑定事件
            $(window).scroll(function () {
                if ($(window).height() + $(document).scrollTop()+1  >= $(document).height()) {
                    if (currentPage <= pages) {
                        query();
                    } else {
                        // 已经到最后了就提示用户已经到底了(引入插件)
                        $(document).dialog({
                            type: "notice",  // 好像时设置样式
                            content: "<span class='info-text'>没有更多了!</span>", // 显示的文字
                            autoClose: 1000 // 多久后关闭
                        })
                    }
                }
            })
        });
    </script>
</head>

<body>
<div class="search-head operationTop">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>评论详情</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<div class="search-head" style="height: 48px;background: white;">
</div>

<div class="replyComment">
    <div render-loop="list">
        <div>
            <div class="container">
                <div class="row">
                    <div class="col-2 comment-head">
                        <a render-fun="getHref" render-key="list.author.id" data-href="/userProfiles.html?id=">
                            <img class="rounded-circle" render-src="list.author.headImgUrl">
                        </a>
                    </div>

                    <div class="col">
                        <p class="authorName"><span render-html="list.author.nickName"></span></p>
                        <span class="comment-date" render-html="list.createTime"></span>
                        <div class="comment-content">
                            <p render-html="list.content">

                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="comment">
                <div class="container">
                    <div class="row2">
                        <div class="col-2 comment-head">
                            <a render-fun="getHref" render-key="list.user.id" data-href="/userProfiles.html?id=">
                                <img class="rounded-circle" render-src="list.user.headImgUrl">
                            </a>
                        </div>
                        <div class="col">
                            <p class="authorName"><span render-html="list.user.nickName"></span></p>
                            <span class="comment-date" render-html="list.parent.createTime"></span>
                            <div class="comment-content">
                                <p render-html="list.parent.content" class="commentText">
                                </p>
                            </div>
                            <div class="d-flex icon">
                                 <a render-fun="getHref" render-key="list.parent.id" data-href="/replyComment.html?id=">
                                <i class="fa  fa-commenting-o " style="margin-right: 10px">
                                    <i render-html="list.commentNums"></i>&nbsp回复
                                </i>
                            </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <hr/>
        </div>
    </div>
</div>

<div style="height:45px;">
</div>
<div class="operation">
    <div class="d-flex justify-content-between">
        <div class="col-10" style="margin-top: 5px;margin-left: 0px;">
            <div class="col-12" style="position: relative;left: 230px;">
                    <a  href="/mine/repliesComment.html?id=0">
                        历史评论>>
                    </a>
            </div>
        </div>
    </div>
</div>
</body>

</html>